package com.yupi.yuaicode.service;

import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.yupi.yuaicode.model.dto.app.AppQueryRequest;
import com.yupi.yuaicode.model.entity.App;
import com.yupi.yuaicode.model.entity.User;
import com.yupi.yuaicode.model.vo.AppVO;
import reactor.core.publisher.Flux;

import java.util.List;

/**
 * 应用 服务层。
 */
public interface AppService extends IService<App> {


    /**
     *  根据id获取应用详情
     * @param app id
     * @return app
     */
    AppVO getAppVO(App app);

    /**
     * 查询封装条件
     * @param appQueryRequest 查询条件
     * @return app列表
     */
    QueryWrapper getQueryWrapper(AppQueryRequest appQueryRequest);

    /**
     * 封装app列表
     * @param appList app列表
     * @return appVO列表
     */
    List<AppVO> getAppVOList(List<App> appList);

    /**
     * 聊天生成代码
     * @param appId app id
     * @param message 聊天内容
     * @param loginUser 登录用户
     * @return 生成的代码
     */
    Flux<String> chatToGenCode(Long appId, String message, User loginUser);

    String deployApp(Long appId, User loginUser);
}
